import java.util.Scanner;

 class Box       // class Box
{		
	private double length , width , height;  //instance variables
				
	public Box(double boxLength , double boxWidth , double boxHeight) throws IllegalArgumentException
	{ 
		if(boxLength <= 0 || boxWidth <= 0 || boxHeight <= 0)
			throw new IllegalArgumentException("Error: Dimension <= 0");
					
		length = boxLength;		
		width = boxWidth;		
		height = boxHeight;	
	}
				
	public double volume() //instant methods
	{      		
		return length * width * height;	
	}
	 	
	public double surfaceArea() 
	{	
		return 2*(length*width + length*height + width*height);	
	}
	
	// Add a toString method
	
	
	// Add an equals method
	
	
	// Add accessor or get methods (Previous Lab10 Task)
	
	// Add mutator or set methods that throw IllegalArgument exception if arguments are not valid (Previous lab task)	 
} // end of Box class

public class BoxDriver         // class BoxDriver
{	  
	public static void main(String[] args) 
	{	
		Scanner kbscanner = new Scanner(System.in);
		double length, width, height;
					
		// Create two Box objects
		Box box1 = null, box2 = null;
		try{
		  System.out.print("Enter the length, width, and height of box1: ");
		  length = kbscanner.nextDouble(); width = kbscanner.nextDouble(); height = kbscanner.nextDouble();
		  		
		  box1 = new Box(length, width, height);
		  
		  System.out.print("Enter the length, width, and height of box2: ");
		  length = kbscanner.nextDouble(); width = kbscanner.nextDouble(); height = kbscanner.nextDouble();		
		  box2 = new Box(length, width, height);
		}
		catch(IllegalArgumentException e){
			System.out.println(e);
			System.exit(1);
		}
					
		double volume, area;
						
		// Get and display volume and surface area of box1		
		volume = box1.volume();		
		area = box1.surfaceArea();		
		System.out.println("The volume of box1 is " + volume + " cubic cm");		
		System.out.println("The surface area of box1 is "+area+" square cm\n");	
					
		// Get and display volume of surface area box2		
		System.out.println("The volume of box2 is " + box2.volume() + " cubic cm");		
		System.out.println("The surface area of box2 is "+area+" square cm\n");
		
		// Write code to print each of the box objects using its toString method
		
		
		// Write code to compare box1 and box2 using the equals method; display the result
		//of the comparioson by an appropriate message
		
			
	} // end of main method
		 
} // end of BoxDriver class
